<template>
  <el-drawer
    @close="close"
    :visible.sync="dialogVisible"
    title="人才审核"
    :size="500"
  >
    <el-row :gutter="10" class="box-card">
      <el-form ref="elForm" :model="formData" size="small" label-width="80px">
        <el-col :span="24">
          <el-form-item label="姓名" prop="name">
            <span>{{ formData.name }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="年龄" prop="age">
            <span>{{ formData.age }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="手机号" prop="mobile">
            <span>{{ formData.mobile }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="个人技能" prop="skillRequirement">
            <span>{{ formData.skillRequirement }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="备注" prop="remark">
            <span>{{ formData.remark }}</span>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
    <div class="footer">
      <el-button @click="handelConfirm(2)">驳回</el-button>
      <el-button type="primary" @click="handelConfirm(1)">通过</el-button>
    </div>
  </el-drawer>
</template>
<script>
import { saveRcjn } from '@/api/rcjn'
export default {
  props: [],
  data () {
    return {
      dialogVisible: false,
      formData: {
        name: '', // 姓名
        age: '', // 年龄
        mobile: '', // 手机号
        skillRequirement: '', // 详细描述个人技能
        remark: '' // 备注
      },
      id: null
    }
  },
  methods: {
    /**
     *
     * @param {*} isEdit 是否编辑
     * @param {*} data 编辑时需要的数据
     */
    async isShow (data) {
      this.dialogVisible = true
      await this.$nextTick()
      const formData = this.formData
      for (const key in formData) {
        formData[key] = data[key]
      }
      this.id = data.id
    },
    close () {
      this.$refs.elForm.resetFields()
      this.dialogVisible = false
    },
    async handelConfirm (status) {
      await saveRcjn({ id: this.id, status })
      this.$notify.success({
        title: '审核完成'
      })
      this.$emit('update:visible')
      this.close()
    }
  }
}

</script>
<style lang="scss" scoped>
.box-card {
  margin-bottom: 10px;
  padding-right: 20px;
  width: 100%;
  padding-left: 10px;
}
.footer {
  display: flex;
  justify-content: space-around;
  margin-bottom: 40px;
  padding-left: 90px;
  padding-right: 20px;
  .el-button {
    width: 100%;
  }
}
::v-deep .el-image {
  margin-left: 10px
}

</style>
